package com.remoter.basic.util;

import com.remoter.basic.configure.Option;

/**
 * @author			koko
 * @date 			2017-08-08 14:30:54
 * @description 	全局变量
 */
public final class Final {
	
	//配置项扩展点默认值以及存储的KEY
	public static final String D_KEY_CONFIGURATION_NAME 	= "_CONFIGURATION_NAME";
	public static final String D_KEY_CONFIGURATION_PATH 	= "_CONFIGURATION_PATH";
	public static final String D_VAL_CONFIGURATION_NAME 	= "remoter";
	public static final String D_VAL_CONFIGURATION_PATH 	= "properties";
	public static final String D_VAL_SEPARATOR				= ",";
	public static final String D_VAL_CHARSET				= "UTF-8";
	//CPU核心数,当为单核时,默认为2
	public static final int PROCRESS = Math.max(2,Runtime.getRuntime().availableProcessors());
	
	public static final String D_VAL_PROTOCOL 				= "socket";
	
	//默认序列化方案
	public static final Option<String> O_VAL_SERIALIZE 	= Option.create("server.serialize","kryo");
	//注册与发现中心
	public static final Option<String> O_VAL_REGISTRY 	= Option.create("server.registry","zookeeper");
	public static final Option<String> O_VAL_FILTER 	= Option.create("server.filter","rpc");
	public static final Option<String> O_VAL_PROVIDER 	= Option.create("server.provider","internal");
	public static final Option<String> O_VAL_CONSUMER 	= Option.create("server.consumer","internal");
	public static final Option<String> O_VAL_CONTEXT 	= Option.create("server.context","internal");
	public static final Option<String> O_VAL_PROXY 		= Option.create("server.proxy","internal");
	public static final Option<String> O_VAL_PROTOCOL 	= Option.create("server.protocol",D_VAL_PROTOCOL);
	public static final Option<String> O_VAL_SERVER 	= Option.create("server.name","remoter");
	public static final Option<String> O_VAL_MONITOR	= Option.create("server.monitor","internal");
	
	public static final int D_VAL_PROVIDER_WEIGHT 			= 100;//默认服务提供者的权重值
	public static final int D_VAL_PROVIDER_EXECUTE			= 0;//默认的并发数量,0为无限制 TPS 
	
	public static final boolean D_VAL_CONSUMER_CHECK 		= false;//是否启动检查consumer与provider的映射
	public static final int D_VAL_CONSUMER_TIMEOUT 			= 10000;//默认服务请求的超时时间(10000为10秒)
	public static final String D_VAL_CONSUMER_LOADBALANCE	= "random";//默认负载均衡策略 random为随机
	public static final boolean D_VAL_CONSUMER_ASYNC		= false;//是否使用异步请求,如果为异步请求默认返回null,即服务调用即结束,提供方继续执行 ,消费方则返回null
	public static final String D_VAL_CONSUMER_FAULT		 	= "failfast";//快速结束
	
}